const template=/*html*/`
<i-form ref="form1" :model="vo" :rules="ruleVo" :label-width="180" :label-colon="true" >
<fieldset class="reset"><legend class="reset">编辑</legend>
<#list list as item>
<#if  (item_index>0 &&  item_index%2 ==0)  >
  </Row>     
</#if>
<#if item_index%2 ==0 >
  <Row>
</#if>
	  <i-col span="12">
	     <form-item label="<#if item.comments?length lte 10>${item.comments}<#else>${item.comments[0..10]}</#if>">
            <#if item.javaType?contains("Date")>
              <date-picker type="date"   v-model="vo.${item.beanLable}" placeholder="<#if item.comments?length  lte 10>${item.comments}<#else>${item.comments[0..10]}</#if>" style="width:100%"></date-picker>
            <#elseif item.javaType?contains("String")>
              <i-input      type="text"   v-model="vo.${item.beanLable}" placeholder="<#if item.comments?length  lte 10>${item.comments}<#else>${item.comments[0..10]}</#if>"></i-input>
            <#else >
              <i-input      type="number" v-model="vo.${item.beanLable}" placeholder="<#if item.comments?length  lte 10>${item.comments}<#else>${item.comments[0..10]}</#if>"></i-input>  
            </#if>
          </form-item>
      </i-col>
<#if  !item_has_next >
<#if  item_index%2 ==0 >
	  <i-col span="12"></i-col>
</#if>
  </Row>  
</#if>	
</#list>
</fieldset>
  <form-item class="float-end">
  	 <button type="button" class="btn  btn-sm btn-outline-success"   @click="editSubmit"       ><svg  width="16" height="16" fill="currentColor"><use xlink:href="#icon_save" /></svg>保存</button>
  	 &nbsp;&nbsp;
  	 <button type="button" class="btn  btn-sm btn-outline-info"      @click="reset"        ><svg  width="16" height="16" fill="currentColor"><use xlink:href="#icon_reset"/></svg>重置</button>
  	 &nbsp;&nbsp;
  	 <button type="button" class="btn  btn-sm btn-outline-secondary" @click="routerToIndex"><svg  width="16" height="16" fill="currentColor"><use xlink:href="#icon_back" /></svg>返回</button>
  </form-item>
</i-form>
`
import {ref} from 'vue'
import {useEdit} from 'base'
export default {
  template,	
  setup() {
	const vo = ref({
	   <#list list as item>
	    ${item.beanLable}:null,
	   </#list>
	})
	const notEmpty = (rule, value, callback) => {
	      if (value === '') {
	        callback(new Error('↑↑↑字段不能为空'));
	      } else {
	        callback();
	      }
	};
	const ruleVo = ref({
	  <#list list as item>
	   ${item.beanLable}: [{ validator: notEmpty, trigger: 'blur' }],
	  </#list>
	})
    const editSetup=useEdit({basePath:'${modPath}<#if modPath?? && modPath !='' && !modPath?ends_with("/") >/</#if>${className?lower_case}',vo})
	return { ...editSetup,ruleVo}
  }
}
